//  不要给我WA WA 叫
//  一定AC
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <iomanip>
#include <climits>
#include <cstring>
#include <string>
#define int long long 
#define x first 
#define y second 
using namespace std;
const int N = 1e5 + 10;
//int a[N];
typedef pair<char,int> PII;
PII p[N];
void solve()
{
     string s;
     cin >> s;
     for(int i = 0; i < s.size(); i++) 
     {
         p[i] = {s[i],i};
     }
   //  for(int i = 0; i < s.size(); i++) cout << p[i].x << " " << p[i].y << endl;
     string s2;
     cin >> s2;
     for(int i = 0; i < s2.size(); i++)
     {
        if(isdigit(s2[i])) cout << p[s2[i] - '0'].x;
        else cout << s2[i];
     }
}
signed main()
{
    ios::sync_with_stdio(0);
    cin.tie(0),cout.tie(0);
    int t = 1;
    while(t -- )  solve();
    return 0;
}